<template>
	<view>
		<view class="search">
			<u-search placeholder="搜索" v-model="keyword" @search='C_search' @custom='C_search'></u-search>
		</view>
		<view class="list">
			<view v-for="(item,index) in list" :key='index' @click="C_listItem1(item.id)">
				<image :src="item.image" mode="aspectFill"></image>
				<view>
					<view>{{item.name}}</view>
					<view class="price">￥{{item.price}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword:'',
				list:[]
			};
		},
		onLoad() {
			this.C_search()
		},
		methods:{
			C_listItem1(id){
				uni.navigateTo({
					url:'/pages/healthyShop/hotList/detail/detail?id='+id
				})
			},
			C_search(){
				this.$u.post('/index/goods',{
					keyword:this.keyword
				}).then(res=>{
					this.list = res.data.list
				})
			}
		}
	}
</script>

<style lang="scss">
	.search{
		border-top: 1px solid #F1F1F1;
		background-color: #FFFFFF;
		padding: 20rpx;
		position: sticky;
		top: 0rpx;
		z-index: 1;
	}
	.list{
		width: 90%;
		margin: auto;
		font-size: 32rpx;
		font-weight: bold;
		>view{
			display: flex;
			margin-bottom: 20rpx;
			background-color: #FFFFFF;
			padding: 20rpx;
			border-radius: 20rpx;
			box-shadow: 0 0 0 rgba(0,0,0,1);
			image{
				margin-right: 20rpx;
				border-radius: 10rpx;
				width: 100rpx;
				height: 100rpx;
			}
			.price{
				color: red;
				margin-top: 20rpx;
			}
		}
	}
</style>
